package com.lingyue.entity.module.es.doc;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @version 1.0.0
 * @author: lzy
 * @date: 2019/12/3 11:38
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@Document(indexName = "new_opportunities", shards = 3, type = "_doc")
public class EsOpportunitiesDocument {

    /**
     * 线索----->
     */

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_ID(PK) , 描述: OPPORTUNITIES表主键ID}")
    @Field(value = "id", type = FieldType.Long)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_API_UNIQUE_KEY , 描述: 线索接口唯一码")
    @Field(value = "optApiUniqueKey", type = FieldType.Keyword)
    private String optUniqueKey;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_DEL_ID , 描述: 经销商ID}")
    @Field(value = "dealerId", type = FieldType.Long)
    private Long dealerId;

    @ApiModelProperty(value = "{表: CAMPAIGN , 字段名: CAM_CODE , 描述: 活动代码}")
    @Field(value = "campaignCode", type = FieldType.Keyword)
    private String campaignCode;

    @ApiModelProperty(value = "{表: CAMPAIGN , 字段名: CAM_NAME , 描述: 活动名称}")
    @Field(value = "campaignName", type = FieldType.Keyword)
    private String campaignName;

    @ApiModelProperty(value = "{表: CAMPAIGN , 字段名: CAM_SCRIPT , 描述: 话术内容}")
    @Field(value = "campaignScript", type = FieldType.Text)
    private String campaignScript;

    @ApiModelProperty(value = "{表: CAMPAIGN , 字段名: CAM_TYPE , 描述: 活动类型}")
    @Field(value = "campaignType", type = FieldType.Keyword)
    private String campaignType;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_TEXT , 描述: 线索背景}")
    @Field(value = "background", type = FieldType.Text)
    private String background;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_SF_COMBINED , 描述: 金融密文}")
    @Field(value = "sfCombined", type = FieldType.Text)
    private String sfCombined;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_DUEDATE , 描述: 逾期日期}")
    @Field(value = "dueDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date dueDate;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_TICKET_ID , 描述: 远程单号}")
    @Field(value = "ticketId", type = FieldType.Keyword)
    private String ticketId;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_TICKET_CREATION_DATE , 描述: 远程单创建时间}")
    @Field(value = "ticketCreationDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date ticketCreationDate;

    @ApiModelProperty(value = "{表: OPPORTUNITIES_FOLLOW , 字段名: OPF_CONNECTED , 描述: 是否接通}")
    @Field(value = "connected", type = FieldType.Keyword)
    private String connected;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_BELONG , 描述: 线索归属人}")
    @Field(value = "belong", type = FieldType.Keyword)
    private String belong;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_ASSIGN_DATE , 描述: 分配日期}")
    @Field(value = "assignDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date assignDate;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_PRE_RESPONSE_DATE , 描述: 上次跟进日期}")
    @Field(value = "preResponseDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date preResponseDate;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_RESPONSE_DATE , 描述: 处理日期}")
    @Field(value = "responseDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date responseDate;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_APPOINTMENT_DATE , 描述: 客户预约日期}")
    @Field(value = "appointmentDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date appointmentDate;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_RESCHEDULED_DATE , 描述: 计划跟进日期、客户到店日期}")
    @Field(value = "rescheduledDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date rescheduledDate;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_FOLLOWER_SUGGESTED , 描述: 建议处理人账号}")
    @Field(value = "followerSuggested", type = FieldType.Keyword)
    private String followerSuggested;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_FOLLOWER , 描述: 实际处理人账号}")
    @Field(value = "follower", type = FieldType.Keyword)
    private String follower;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_PRE_FOLLOWER , 描述: 上次跟进人账号}")
    @Field(value = "preFollower", type = FieldType.Keyword)
    private String preFollower;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_RESPONSE_STATUS ," +
            "描述: 处理状态，0-未分配、7-未处理、10-客户预约、11-咨询专家、12-持续跟进、13-意向客户、" +
            "20-客户拒绝 21-NSP拒绝、22-预约到店、23-金融成交、24-二手车成交、25-成功联系、" +
            "98-线索删除、99-线索失效}")
    @Field(value = "responseStatus", type = FieldType.Integer)
    private Integer responseStatus;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_LEADS_STATUS , 描述: 1-去他店，2-回本店，D-新增，E-过期}")
    @Field(value = "leadsStatus", type = FieldType.Keyword)
    private String leadsStatus;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_INTENT_MODEL , 描述: 意向车型}")
    @Field(value = "purposeModel", type = FieldType.Keyword)
    private Integer purposeModel;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_PURCHASE_TYPE , 描述: 成交类型}")
    @Field(value = "purchaseType", type = FieldType.Keyword)
    private Integer purchaseType;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_DEPARTMENT , 描述: 部门}")
    @Field(value = "department", type = FieldType.Keyword)
    private String department;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_CONTACT_WAY , 描述: 联系方式}")
    @Field(value = "contactWay", type = FieldType.Keyword)
    private Integer contactWay;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_APPOINTMENT_TYPE , 描述: 预约类型}")
    @Field(value = "appointmentType", type = FieldType.Keyword)
    private String appointmentType;

    @ApiModelProperty(value = "{表: OPPORTUNITIES_FOLLOW , 字段名: OPF_TYPE_FIRST , 描述: 一级战败原因}")
    @Field(value = "reason1", type = FieldType.Keyword)
    private String reason1;

    @ApiModelProperty(value = "{表: OPPORTUNITIES_FOLLOW , 字段名: OPF_TYPE_SECOND , 描述: 二级战败原因}")
    @Field(value = "reason2", type = FieldType.Keyword)
    private String reason2;

    @ApiModelProperty(value = "{表: OPPORTUNITIES_FOLLOW , 字段名: OPF_TYPE_OTHER , 描述: 三级战败原因}")
    @Field(value = "reason3", type = FieldType.Keyword)
    private String reason3;

    @ApiModelProperty(value = "{表: OPPORTUNITIES_FOLLOW , 字段名: OPF_LOSS_DIRECTION , 描述: 一级流失方向}")
    @Field(value = "loss1", type = FieldType.Keyword)
    private String loss1;

    @ApiModelProperty(value = "{表: OPPORTUNITIES_FOLLOW , 字段名: OPF_LOSS_DIRECTION_SUB , 描述: 二级流失方向}")
    @Field(value = "loss2", type = FieldType.Keyword)
    private String loss2;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_CREATE_DATE , 描述: 线索推送日期}")
    @Field(value = "createDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createDate;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_UPDATE_DATE , 描述: 线索更新日期}")
    @Field(value = "updateDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateDate;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_REMARK , 描述: 线索跟进备注}")
    @Field(value = "remark", type = FieldType.Keyword)
    private String remark;

    @ApiModelProperty(value = "{表: OPPORTUNITIES , 字段名: OPT_VALID_FLAG , 描述: 线索跟进备注}")
    @Field(value = "valid", type = FieldType.Keyword)
    private String valid;

    @ApiModelProperty(value = "是否带子类线索，Y/N")
    @Field(value = "cascade", type = FieldType.Keyword)
    private String cascade;

    @ApiModelProperty(value = "是否终结线索状态，Y/N")
    @Field(value = "finished", type = FieldType.Keyword)
    private String finished;

    /**
     * 车----->
     */

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_VIN , 描述: 车架号}")
    @Field(value = "vin", type = FieldType.Keyword)
    private String vin;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_API_UNIQUE_KEY , 描述: 车辆接口唯一码}")
    @Field(value = "vehUniqueKey", type = FieldType.Keyword)
    private String vehUniqueKey;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_REGULAR  , 描述: 是否常客户}")
    @Field(value = "regular", type = FieldType.Keyword)
    private String regular;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_HANDOVER_DATE , 描述: 首次接触时间/交车日期}")
    @Field(value = "handoverDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date handoverDate;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_MODEL , 描述: 车型}")
    @Field(value = "model", type = FieldType.Keyword)
    private String model;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_LICENSE_PLATE , 描述: 车牌号}")
    @Field(value = "licensePlate", type = FieldType.Keyword)
    private String licensePlate;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_DAILY_AVG_MILEAGE , 描述: 车牌号}")
    @Field(value = "dailyAvgMileage", type = FieldType.Double)
    private BigDecimal dailyAvgMileage;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_INS_START_DATE , 描述: 参保时间}")
    @Field(value = "insStartDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date insStartDate;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_INS_END_DATE , 描述: 保险到期时间}")
    @Field(value = "insEndDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date insEndDate;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_WARRANTY_START_DATE , 描述: 保修开始时间}")
    @Field(value = "warrantyStartDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date warrantyStartDate;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_WARRANTY_END_DATE , 描述: 保修结束时间}")
    @Field(value = "warrantyEndDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date warrantyEndDate;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_VALUE_SERVICE  , 描述: Value Service 服务提醒（长悦客户）}")
    @Field(value = "valueService", type = FieldType.Keyword)
    private String valueService;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_CONNECT_DRIVE_FLAG , 描述: 是否配备互联驾驶功能}")
    @Field(value = "connectDriveFlag", type = FieldType.Keyword)
    private String connectDriveFlag;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_CONNECT_DRIVE_STATUS , 描述: 互联驾驶状态}")
    @Field(value = "connectDriverStatus", type = FieldType.Keyword)
    private String connectDriverStatus;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_CONNECT_DRIVE_END_DATE , 描述: 互联驾驶结束时间}")
    @Field(value = "connectDriveEndDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date connectDriveEndDate;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_LAST_RETURN_DATE , 描述: 上次到经销商日期}")
    @Field(value = "lastReturnDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastReturnDate;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_LAST_RETURN_MILEAGE , 描述: 上次到经销商车辆里程}")
    @Field(value = "lastReturnMileage", type = FieldType.Double)
    private BigDecimal lastReturnMileage;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_LAST_RETURN_SPENDING , 描述: 最近门店消费}")
    @Field(value = "lastReturnSpending", type = FieldType.Double)
    private BigDecimal lastReturnSpending;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_LAST_OIL_DATE  , 描述: 上次机油保养时间}")
    @Field(value = "lastOilDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastOilDate;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_LAST_OIL_MILEAGE  , 描述: 上次机油保养时车辆里程}")
    @Field(value = "lastOilMileage", type = FieldType.Double)
    private BigDecimal lastOilMileage;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_LAST_VISIT_BILLING_DATE , 描述: 最后一次访问本经销商日期}")
    @Field(value = "lastVisitBillingDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastVisitBillingDate;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_LAST_VISIT_MILEAGE , 描述: 最后一次访问经销商时车辆里程}")
    @Field(value = "lastVisitMileage", type = FieldType.Keyword)
    private BigDecimal lastVisitMileage;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_LAST_OIL_DEALER , 描述: 上次机油保养经销商}")
    @Field(value = "lastOilDealer", type = FieldType.Keyword)
    private String lastOilDealer;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_LAST_OIL_DEALER_ID , 描述: 上次机油保养经销商代码}")
    @Field(value = "lastOilDealerId", type = FieldType.Keyword)
    private String lastOilDealerId;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_LAST_RETURN_CONTACT , 描述: 最近销售顾问姓名}")
    @Field(value = "lastReturnContact", type = FieldType.Keyword)
    private String lastReturnContact;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_LAST_VISIT_DEALER , 描述: 最近拜访经销商（网内回店经销商）}")
    @Field(value = "lastVisitDealer", type = FieldType.Keyword)
    private String lastVisitDealer;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_LAST_VISIT_DEALER_ID , 描述: 最近拜访经销商编号（网内回店经销商代码）}")
    @Field(value = "lastVisitDealerId", type = FieldType.Keyword)
    private String lastVisitDealerId;

    @ApiModelProperty(value = "{表: VEHICLE , 字段名: VEH_BSI , 描述: BMW服务包含说明}")
    @Field(value = "bsi", type = FieldType.Text)
    private String bsi;

    /**
     * 客户---->
     */

    @ApiModelProperty(value = "{表: CUS_VEH_RELATION , 字段名: CVR_CUSTOMER_ID , 描述: 车辆主要联系人CUSTOMER.CUS_CUSTOMER_ID}")
    @Field(value = "customerId", type = FieldType.Keyword)
    private String customerId;

    @ApiModelProperty(value = "{表: CUS_VEH_RELATION , 字段名: CVR_CUSTOMER_TYPE , 描述: 客户类型：售后联系人/车主等 O – Owner/A – Aftersales Contact/B – Both/N – Null}")
    @Field(value = "customerType", type = FieldType.Keyword)
    private String customerType;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_API_UNIQUE_KEY , 描述: 客户接口唯一码}")
    @Field(value = "cusUniqueKey", type = FieldType.Keyword)
    private String cusUniqueKey;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_NAME , 描述: 客户姓名}")
    @Field(value = "customerName", type = FieldType.Keyword)
    private String customerName;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_MOBILE , 描述: 手机号}")
    @Field(value = "customerMobile", type = FieldType.Keyword)
    private String customerMobile;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_MOBILE_SPARE , 描述: 备用手机号}")
    @Field(value = "customerMobileSpare", type = FieldType.Keyword)
    private String customerMobileSpare;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_VEH_INTEREST , 描述: 感兴趣车型}")
    @Field(value = "interestedModels", type = FieldType.Keyword)
    private String interestedModels;

}
